package ccrClasses.layer2;

import ccrClasses.ICcr;

public class Direction implements ICcr {
	
	public final static String OPEN_TAG = "<Direction>";

	public final static String CLOSE_TAG = "</Direction>";
	
	private Dose dose;
	
	private Route route;
	
	private Frequency frequency;
	
	public Direction(Dose dose, Route route, Frequency frequency) {
		super();
		this.dose = dose;
		this.route = route;
		this.frequency = frequency;
	}
	
	public Direction(Dose dose, Route route) {
		super();
		this.dose = dose;
		this.route = route;		
	}
	
	public Direction(Dose dose) {
		super();
		this.dose = dose;
	}

	@Override
	public String constructCcrString() {
		String ccrDirection = OPEN_TAG;
		if(dose != null){
			ccrDirection += dose.constructCcrString();
		}
		
		if(route != null){
			ccrDirection += route.constructCcrString();		
		}
		
		if(frequency != null){
			ccrDirection += frequency.constructCcrString();
		}

		ccrDirection += CLOSE_TAG;
		return ccrDirection;
	}

	/**
	 * @return the dose
	 */
	public Dose getDose() {
		return dose;
	}

	/**
	 * @param dose the dose to set
	 */
	public void setDose(Dose dose) {
		this.dose = dose;
	}

	/**
	 * @return the route
	 */
	public Route getRoute() {
		return route;
	}

	/**
	 * @param route the route to set
	 */
	public void setRoute(Route route) {
		this.route = route;
	}

	/**
	 * @return the frequency
	 */
	public Frequency getFrequency() {
		return frequency;
	}

	/**
	 * @param frequency the frequency to set
	 */
	public void setFrequency(Frequency frequency) {
		this.frequency = frequency;
	}

}
